package com.ruoyi.spin.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 项目枚举类
 *
 * @author Lorry
 * @date 2021-1-9 14:50
 */
public class SpinEnums {
  @AllArgsConstructor
  @Getter
  public enum StateEnum {
    /** 任务类型枚举 */
    NORMAL(0, "正常"),
    DISABLE(1, "禁用"),
    ;
    private final Integer state;
    private final String desc;
  }

  @AllArgsConstructor
  @Getter
  public enum PlatformEnum {
    /** 平台类型 */
    TIKTOK(1, "tik", "tiktok"),
    SPIN(2, "spin", "spin"),
    ;
    private final Integer platform;
    private final String abbr;
    private final String name;

    public static String getAbbr(Integer platform) {
      PlatformEnum[] values = values();
      for (PlatformEnum se : values) {
        if (se.getPlatform().equals(platform)) {
          return se.getAbbr();
        }
      }
      return null;
    }
  }

  @AllArgsConstructor
  @Getter
  public enum SpinTypeEnum {
    /** 抽奖类型枚举 */
    COIN_SPIN(1, "金币抽奖"),
    FREE_SPIN(2, "免费抽奖"),
    ;
    private final Integer type;
    private final String desc;

    public static String getSpin(Integer type) {
      SpinTypeEnum[] values = values();
      for (SpinTypeEnum se : values) {
        if (se.getType().equals(type)) {
          return se.getDesc();
        }
      }
      return null;
    }
  }

  @AllArgsConstructor
  @Getter
  public enum RaffleEventEnum {
    /** 抽奖类型枚举 */
    WEEK_VIP(
        3, 7, "周会员奖", "week_title_str", "week_desc_str", "week_prize_str", "week_prize_desc_str"),
    MONTH_VIP(
        2,
        30,
        "月会员奖",
        "month_title_str",
        "month_desc_str",
        "month_prize_str",
        "month_prize_desc_str"),
    ANNUAL_VIP(
        1,
        365,
        "年会员奖",
        "annual_title_str",
        "annual_desc_str",
        "annual_prize_str",
        "annual_prize_desc_str"),
    LUCKY_VIP(
        4,
        20,
        "幸运奖",
        "lucky_title_str",
        "lucky_desc_str",
        "lucky_prize_str",
        "lucky_prize_desc_str"),
    ;
    private final Integer type;
    private final Integer freeDays;
    private final String desc;
    private final String titleKey;
    private final String descKey;
    private final String prizeKey;
    private final String prizeDescKey;

    public static RaffleEventEnum getEvent(Integer type) {
      RaffleEventEnum[] values = values();
      for (RaffleEventEnum se : values) {
        if (se.getType().equals(type)) {
          return se;
        }
      }
      return null;
    }

    public static RaffleEventEnum getEvent(String prizeKey) {
      RaffleEventEnum[] values = values();
      for (RaffleEventEnum se : values) {
        if (se.getPrizeKey().equals(prizeKey)) {
          return se;
        }
      }
      return null;
    }
  }

  @AllArgsConstructor
  @Getter
  public enum AppTypeEnum {
    /** 应用类型枚举 */
    SPIN_LINK(1, "spin link"),
    SPIN_THE_WHEEL(2, "spin the wheel"),
    ;
    private final Integer type;
    private final String desc;

    public static String getSpin(Integer type) {
      AppTypeEnum[] values = values();
      for (AppTypeEnum se : values) {
        if (se.getType().equals(type)) {
          return se.getDesc();
        }
      }
      return null;
    }
  }

  @AllArgsConstructor
  public enum SourceTypeEnum {
    /** 应用类型枚举 */
    SOURCE_TYPE_ENUM(
        1, "spinLinkMaster", "http://api.spinlinkmaster.com/cm/coin/list?current=0&size=20"),
    GET_COIN_SPIN(2, "get-Coin-Spin", "http://128.199.255.88/api/get-spins"),
    ;

    public final Integer type;
    public final String source;
    public final String url;
  }
}
